//go:build wireinject

package main

import (
	"booksmart/book/interactive/grpc"
	"booksmart/book/interactive/ioc"
	"booksmart/book/interactive/repository"
	"booksmart/book/interactive/repository/cache"
	"booksmart/book/interactive/repository/dao"
	"booksmart/book/interactive/service"
	"github.com/google/wire"
)

var interactiveSvcProvider = wire.NewSet(
	service.NewInteractiveService,
	repository.NewInteractiveRepository,
	cache.NewRedisInteractiveCache,
	dao.NewGROMInteractiveDAO,
)

var thirdPartySet = wire.NewSet(
	ioc.InitDB, ioc.InitRedis, ioc.InitLogger,
)

var nacosSet = wire.NewSet(
	ioc.InitNacosClient,
)

func InitAPP() *App {
	wire.Build(interactiveSvcProvider, thirdPartySet, nacosSet,
		ioc.InitGRPCxServer,
		grpc.NewInteractiveServer,
		wire.Struct(new(App), "*"),
	)

	return new(App)
}
